package ygw.study.designPatterns.chain2;

/**
 * <p>
 * 副总经理类
 * </p>
 * <p>
 * Copyright:.All rights reserved.
 * </p>
 * <p>
 * Company:Zsoft
 * </p>
 * <p>
 * CreateDate: 2021-05-18
 * </p>
 * 
 * @author YuGongWen
 * @history Mender: YuGongWen；Date: 2021-05-18；
 */
public class ViceGeneralManager extends Leader {


    /**
     * 初始化父类(传入姓名)
     */
    public ViceGeneralManager(String name) {
        super(name);
    }


    /**
     * 处理业务的核心方法, 对请假信息进行处理
     */
    @Override
    public void handleLeave(LeaveInfo request) {
        if (request.getLeaveDays() < 20) {
            System.out.println("员工: " + request.getEmpName() + "请假,天数: " + request.getLeaveDays() + ",理由: " + request.getReason());
            System.out.println("副总经理: " + this.name + ",审批通过!");
        }else {
            if (this.nextLeader!=null) {//如果有后继对象, 让后继对象继续处理
                this.nextLeader.handleLeave(request);
            }
        }
    }

}